A flash memory is a popular storage means for storing software codes and user data. There are two types of flash memories: NOR flash and NAND flash. NOR flash memories are typically characterized by fewer errors, excellent data stability, and a semipermanent life span. The storage capacity of NOR flash memories is very limited (e.g., 128 MB). On the other hand, the NAND flash memories are designed to provide mass storage (e.g., 32 GB) and are faster and cheaper than the NOR types. However, NAND flash memories suffer from a major drawback that cells of the memory are not reliable. Specifically, a NAND flash memory device usually contains non-functional blocks which may be a result of the manufacturing process or operation of the memory. The non-functional blocks are also referred to as “bad blocks.”
A typical system on chip (SoC) includes a NAND flash memory and controller for controlling the same, an internal memory, and a CPU. A NAND flash memory stores system initialization and operating system (OS) code. When booting the CPU, this code is loaded into the internal memory, and thereafter the CPU executes the OS operations directly from the internal memory. This operation is initiated by the boot code. Storing the boot code in the NAND flash memory may present a problem of halting the CPU from booting if such code resides in a bad block.
In the related art, three techniques have been suggested to ensure the booting of the SoC. In accordance with one technique the boot code resides in a NOR flash memory device that is considered reliable. The CPU boots from the NOR flash memory, and then uses the NAND flash memory for bulk storage. The disadvantage of such a technique is that it requires an additional costly memory. Another technique is based on a read-only-memory (ROM) integrated in the SoC. The ROM is burnt with the boot code at the fabrication of the SoC. The drawback of this technique is that the boot code cannot be changed or modified once the SoC is fabricated. Thus, a bug in the boot code may result in an inoperable device. Another technique discussed in the related art includes saving the boot code in 0-th block of the NAND flash memory. This block is guaranteed to be valid by the memory's manufacturer. At the SoC booting, the boot code can always be copied from block 0 to the internal memory and be executed therefrom. This solution is limited to NAND flash memories with valid 0-th block. In addition, the 0-th block can be damaged or unexpectedly erased during the operation.
Thus, it would be highly advantageous to provide a solution that would ensure reliable booting.